package com.ruoyi.veterinary.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.veterinary.mapper.VetSupplierMapper;
import com.ruoyi.veterinary.domain.VetSupplier;
import com.ruoyi.veterinary.service.IVetSupplierService;

/**
 * 供应商Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-01-19
 */
@Service
public class VetSupplierServiceImpl implements IVetSupplierService 
{
    @Autowired
    private VetSupplierMapper vetSupplierMapper;

    /**
     * 查询供应商
     * 
     * @param supplierId 供应商主键
     * @return 供应商
     */
    @Override
    public VetSupplier selectVetSupplierBySupplierId(Long supplierId)
    {
        return vetSupplierMapper.selectVetSupplierBySupplierId(supplierId);
    }

    /**
     * 查询供应商列表
     * 
     * @param vetSupplier 供应商
     * @return 供应商
     */
    @Override
    public List<VetSupplier> selectVetSupplierList(VetSupplier vetSupplier)
    {
        return vetSupplierMapper.selectVetSupplierList(vetSupplier);
    }

    /**
     * 新增供应商
     * 
     * @param vetSupplier 供应商
     * @return 结果
     */
    @Override
    public int insertVetSupplier(VetSupplier vetSupplier)
    {
        vetSupplier.setCreateTime(DateUtils.getNowDate());
        return vetSupplierMapper.insertVetSupplier(vetSupplier);
    }

    /**
     * 修改供应商
     * 
     * @param vetSupplier 供应商
     * @return 结果
     */
    @Override
    public int updateVetSupplier(VetSupplier vetSupplier)
    {
        vetSupplier.setUpdateTime(DateUtils.getNowDate());
        return vetSupplierMapper.updateVetSupplier(vetSupplier);
    }

    /**
     * 批量删除供应商
     * 
     * @param supplierIds 需要删除的供应商主键
     * @return 结果
     */
    @Override
    public int deleteVetSupplierBySupplierIds(Long[] supplierIds)
    {
        return vetSupplierMapper.deleteVetSupplierBySupplierIds(supplierIds);
    }

    /**
     * 删除供应商信息
     * 
     * @param supplierId 供应商主键
     * @return 结果
     */
    @Override
    public int deleteVetSupplierBySupplierId(Long supplierId)
    {
        return vetSupplierMapper.deleteVetSupplierBySupplierId(supplierId);
    }

    /**
     * 查询所有正常状态的供应商
     * 
     * @return 供应商列表
     */
    @Override
    public List<VetSupplier> selectActiveSupplierList()
    {
        return vetSupplierMapper.selectActiveSupplierList();
    }
}